#--------------------------------------------------------------------------------
#
# Makefile for the calculator
# Programmer: Leonidas Fegaras
# Date: 1/9/03
#
#--------------------------------------------------------------------------------

JAVAC=javac -g
JAVA=java
CLASSPATH=.:/public/cse/5317-501/System.jar
export CLASSPATH

all: Eval.class CalcParser.class Main.class

CalcLex.java: calc.lex
	      $(JAVA) JLex.Main calc.lex
	      mv calc.lex.java CalcLex.java

CalcParser.java: calc.gen
	         $(JAVA) Gen calc.gen calc.cup
	         $(JAVA) java_cup.Main -parser CalcParser calc.cup

CalcParser.class: CalcParser.java CalcLex.java
	          $(JAVAC) CalcParser.java sym.java CalcLex.java

%.class: %.gen
	 $(JAVA) Gen $< $*.out.java
	 $(JAVAC) $*.out.java

Main.class: Main.java
	    $(JAVAC) Main.java

run:    all
	$(JAVA) Main

clean: 
	/bin/rm -f *~ *.class *.out.java calc.cup CalcLex.java CalcParser.java sym.java
